package xworker.gluon.glisten.control;

import com.gluonhq.charm.glisten.control.Message;
import javafx.util.Duration;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.util.JavaFXUtils;

public class MessageActions {
    public static void init(Message node, Thing thing, ActionContext actionContext) {
        Duration duration = JavaFXUtils.getDuration(thing, "duration", actionContext);
        if (duration != null) {
            node.setDuration(duration);
        }

        String id = JavaFXUtils.getObject(thing, "id", actionContext);
        if (id != null) {
            node.setId(id);
        }

        String message = JavaFXUtils.getObject(thing, "message", actionContext);
        if (message != null) {
            node.setMessage(message);
        }
    }
}
